<template>
  <div class="newshop">
    <div class="new">
      <span>新品抢购</span>
      <div class="countDown">
        <van-count-down :time="time">
          <template v-slot="timeData">
            <span class="block">{{ timeData.hours &lt; 10 ? '0' + timeData.hours : timeData.hours }}</span>
            <span class="colon">:</span>
            <span class="block">{{ timeData.minutes &lt; 10 ? '0' + timeData.minutes : timeData.minutes }}</span>
            <span class="colon">:</span>
            <span class="block">{{ timeData.seconds &lt; 10 ? '0' + timeData.seconds : timeData.seconds }}</span>
          </template>
        </van-count-down>
      </div>
    </div>
    <ul>
      <li  v-for="item of newshoplist" :key="item.proId">
        <van-image
          lazy-load
          :src="item.proImg"
        />
        <h2>{{ item.proTitle }}</h2>
        <p><span style="color: #FF6666;font-size: 14px">{{ item.price }}</span>/<span style="font-size: 14px; color: #999999">{{ item.proUnit }}</span></p>
      </li>
    </ul>
  </div>
</template>

<script>
import Vue from 'vue'
import { CountDown } from 'vant'
Vue.use(CountDown)
export default {
  props: {
    newshoplist: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data () {
    return {
      time: 10 * 60 * 60 * 1000
    }
  }
}
</script>

<style lang="scss">
@import '@/lib/reset.scss';
.newshop{
  width: 100%;
  height: 160px;
  background-color: #fff;
  margin-top: 10px;
  .new{
    width: 100%;
    height: 30px;
    // background-color: deepskyblue;
    span{
      font-size: 16px;
      color: #FF6666;
      font-weight: 550;
      margin:5px 10px;
      line-height: 35px;
      letter-spacing:1px;
    }
    .countDown{
      width: 185px;
      height: 100%;
      float: right;
      .van-count-down{
        margin-right: 10px;
        float: right;
      }
      .colon {
        display: inline-block;
        margin: -2px -8px;
        color: #ee0a24;
      }
      .block {
        display: inline-block;
        width: 29px;
        height: 20px;
        color: #fff;
        font-size: 10px;
        line-height: 22px;
        text-align: center;
        background-color: #FF6666;
        border-radius: 3px;
      }
    }
  }
  ul{
    width: 100%;
    overflow: auto;
    white-space: nowrap;
    margin-top: 5px;
    display: flex;
    // justify-content: space-around;
    li{
      display: inline-block;
      width: 90px;
      height: 120px;
      margin-left: 10px;
      img{
        display: block;
        width: 90px;
        height: 65px;
        border: 1px solid white;
      }
      h2{
        text-align: center;
        margin-top: 13px;
        font-size: 12.5px;
        color: #666666;
        font-weight: normal;
      }
      p{
        text-align: center;
      }
    }
  }
}
</style>
